
Research
Security News
Lazarus Strikes npm Again with New Wave of Malicious Packages
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
@codemirror/lang-rust
Advanced tools
@codemirror/lang-rust is a language support package for the CodeMirror 6 code editor, specifically designed to provide syntax highlighting, code folding, and other language-specific features for the Rust programming language.
Syntax Highlighting
This feature provides syntax highlighting for Rust code. The code sample demonstrates how to set up a CodeMirror editor with Rust syntax highlighting.
import { rust } from '@codemirror/lang-rust';
import { EditorState } from '@codemirror/state';
import { EditorView, basicSetup } from '@codemirror/basic-setup';
const state = EditorState.create({
doc: 'fn main() { println!("Hello, world!"); }',
extensions: [basicSetup, rust()]
});
const view = new EditorView({
state,
parent: document.body
});
Code Folding
This feature allows for code folding in Rust code. The code sample shows how to set up a CodeMirror editor with Rust syntax highlighting and code folding capabilities.
import { rust } from '@codemirror/lang-rust';
import { foldGutter } from '@codemirror/fold';
import { EditorState } from '@codemirror/state';
import { EditorView, basicSetup } from '@codemirror/basic-setup';
const state = EditorState.create({
doc: 'fn main() { println!("Hello, world!"); }',
extensions: [basicSetup, rust(), foldGutter()]
});
const view = new EditorView({
state,
parent: document.body
});
Auto-completion
This feature provides auto-completion for Rust code. The code sample demonstrates how to set up a CodeMirror editor with Rust syntax highlighting and auto-completion.
import { rust } from '@codemirror/lang-rust';
import { autocompletion } from '@codemirror/autocomplete';
import { EditorState } from '@codemirror/state';
import { EditorView, basicSetup } from '@codemirror/basic-setup';
const state = EditorState.create({
doc: 'fn main() { println!("Hello, world!"); }',
extensions: [basicSetup, rust(), autocompletion()]
});
const view = new EditorView({
state,
parent: document.body
});
@codemirror/lang-javascript provides similar functionalities for JavaScript as @codemirror/lang-rust does for Rust. It includes syntax highlighting, code folding, and auto-completion for JavaScript code.
@codemirror/lang-python offers language support for Python in the CodeMirror 6 editor. It provides features like syntax highlighting, code folding, and auto-completion for Python code, similar to what @codemirror/lang-rust offers for Rust.
@codemirror/lang-java is a language support package for Java in the CodeMirror 6 editor. It includes functionalities such as syntax highlighting, code folding, and auto-completion for Java code, comparable to the features provided by @codemirror/lang-rust for Rust.
[ WEBSITE | ISSUES | FORUM | CHANGELOG ]
This package implements Rust language support for the CodeMirror code editor.
The project page has more information, a number of examples and the documentation.
This code is released under an MIT license.
We aim to be an inclusive, welcoming community. To make that explicit, we have a code of conduct that applies to communication around the project.
rust() → LanguageSupport
Rust language support
rustLanguage: LezerLanguage
A syntax provider based on the Lezer Rust parser, extended with highlighting and indentation information.
0.17.1 (2021-01-06)
The package now also exports a CommonJS module.
FAQs
Rust language support for the CodeMirror code editor
The npm package @codemirror/lang-rust receives a total of 170,760 weekly downloads. As such, @codemirror/lang-rust popularity was classified as popular.
We found that @codemirror/lang-rust demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.
Security News
Opengrep continues building momentum with the alpha release of its Playground tool, demonstrating the project's rapid evolution just two months after its initial launch.